import java.util.HashMap;

public class ConcreteMediator implements Mediator {
    private HashMap<String, Colleague> colleagues = new HashMap<>();
    
    @Override
    public void register(Colleague colleague, String name) {
        colleagues.put(name, colleague);
    }

    @Override
    public void relay(Colleague colleague, String message) {
        for (Colleague c : colleagues.values()) {
            if (c != colleague) {
                c.receive(colleague.name + ": " + message);
            }
        }
    }
}